import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';

@Injectable()
export class LoggerMiddleware implements NestMiddleware {
  use(req: Request, res: Response, next: NextFunction) {
    console.log('Request...');
    console.log(`protocol ==> ${req.protocol}`);
    console.log(`hostname ==> ${req.hostname}`);
    console.log(`url ==> ${req.originalUrl}`);
    console.log(`ip ==> ${req.ip}`);
    console.log(`ips ==> ${req.ips}`);
    next();
  }
}
